#ifndef LIB_GEOUTILS_PROPERTIES_H
#define LIB_GEOUTILS_PROPERTIES_H
#include "libGeoutils/io/serialize.h"
#include <string>
#include <memory>
#include <map>

namespace geo {
namespace prop {

template<class T>
using PropertiesMap = std::map<std::string, T>;

class GEOUTILS_EXPORT Properties : public geo::io::IOBase
{
public:
	using sptr = std::shared_ptr<Properties>;
	using csptr = std::shared_ptr<const Properties>;

	Properties(bool haveUuid = false);
	virtual ~Properties();

	template<class T> bool getProperty(const std::string& key, T& value) const;
	template<class T> void setProperty(const std::string& key, const T& value);

	bool to_string(std::string& out_str) const override;
	bool to_json(std::string& out_str) const override;
	bool from_json(const std::string& in_str) override;

protected:
	PropertiesMap<std::string> mStringProps;
	PropertiesMap<double> mDoubleProps;
	PropertiesMap<bool> mBoolProps;
	PropertiesMap<int> mIntProps;

private:

};

} // namespace prop
} // namespace geo

#ifndef QUICK_PROP_SETGET
#define QUICK_PROP_SETGET(type, name, json_key)		\
													\
void set##name(type value)							\
{													\
	setProperty<type>(json_key, value);				\
}													\
													\
type get##name() const								\
{													\
	type value;										\
	getProperty<type>(json_key, value);				\
	return value;									\
}

#endif // QUICK_PROP_SETGET



#endif // !LIB_GEOUTILS_PROPERTIES_H
